<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
    <style>
			.ApiListWrap label{ display:block; padding:3px 3px; margin:0; vertical-align:middle; text-align:left; float:left; width:130px; color:#999;}
			.ApiListWrap label.check{ color: #000;}
			.ApiListWrap input{ vertical-align:middle;}
			.AppSecret{ color:#000;}
    </style>
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <form enctype="multipart/form-data" method="post" id="frm">
        <div class="table">
           <div class="toolbars">
                <li class="toolbar"><a id="btnSaveAll" href="{$Url}addSecret"  title="创建通信秘钥" target="_self">创建通信秘钥</a></li>
            </div>
            <table class="datatable" id="datatable">
                <tr>
                     <th style="width:75px;">AppID</th>
                     <th style="width:250px;">AppSecret</th>
                     <th style="width:400px;">接口权限</th>
                     
                     <th>备注</th>
                     <th style="width:120px;">创建时间</th>
                     <th style="width:60px;">是否启用</th>
                     <th style="width:150px;">操作</th>
                </tr>  
                <notempty name="Data">
                <volist name="Data" id="d">
                    <tr>
                        <td>{$d.AppID}</td>
                        <td><span class="AppSecret">{$d.AppSecret}</span></td>
                        <td class="ApiListWrap">
                            <volist name="Api" id="a">
                                <in name="a.ApiID" value="$d.ApiList">
                                    <label class="check"><input class="checkrow" type="checkbox" value="{$a.ApiID}"  name="ApiList[]" disabled="disabled" checked="checked" />{$a.ApiName}</label>
                                <else/>
                                    <label><input class="checkrow" type="checkbox" value="{$a.ApiID}"  name="ApiList[]" disabled="disabled" />{$a.ApiName}</label>
                                </in>
                            </volist>
                        </td>
                        <td  style="text-align:left; padding-left:3px;">{$d.SecretRemark}</td>
                        <td>{$d.SecretTime|strtotime|yd_friend_date}</td>

                        <td>
                            <eq name="d.IsEnable" value="1">
                                <span style="color:black;cursor:pointer;"  onclick="toggleStatus(this,{$d.SecretID},'secret')">启用</span>
                            <else/>
                                <span style="color:red;cursor:pointer;"  onclick="toggleStatus(this,{$d.SecretID},'secret')">禁用</span>
                            </eq>
                        </td>
                        <td class="operator">
                            <a style="float:left" href="{$Url}modifySecret/id/{$d.SecretID}" id="btnEdit">修改</a>
                            <div class="btn-sep"></div>
                            <a style="float:left" onclick="del({$d.SecretID})" class="btnDel">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                    <tr><td colspan="7" id="NoData">{$Think.lang.NoDataTip}</td></tr>
                </notempty>                                  
            </table>
             <div class="tfoot">
                  <div id="notice"><b>说明：</b><span class="notice-item">通信秘钥用于服务器和App通信，请勿泄露</span></div>
             </div>
        </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
function del(id){
	$.confirm("{$Think.lang.DeleteTip}", function () {
		url = "{$Url}delSecret?id="+id;
		location.href = url;
	}, function () {
		return true;
	});
}

//选择全部
function SelectAll(){
	if( $("#chkAll").is(':checked') ){
		$(".ApiListWrap:checkbox").attr('checked', true);
	}else{
		$(".ApiListWrap:checkbox").attr('checked', false);
	}
}
</script>